package com.hehe.ai.langchain4j.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hehe.ai.langchain4j.entity.Appointment;
import com.hehe.ai.langchain4j.mapper.AppointmentMapper;
import com.hehe.ai.langchain4j.service.AppointmentService;
import org.springframework.stereotype.Service;

/**
 * @author: hehe
 * @create: 2025-05-14 15:49
 * @Description:
 */
@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment> implements AppointmentService {
    @Override
    public Appointment getOne(Appointment appointment) {
        LambdaQueryWrapper<Appointment> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(appointment.getUsername()!=null,Appointment::getUsername, appointment.getUsername())
                .eq(appointment.getIdCard()!=null,Appointment::getIdCard, appointment.getIdCard())
                .eq(appointment.getDepartment()!=null,Appointment::getDepartment, appointment.getDepartment())
                .eq(appointment.getDate()!=null,Appointment::getDate, appointment.getDate())
                .eq(appointment.getTime()!=null,Appointment::getTime, appointment.getTime());
        Appointment res = baseMapper.selectOne(queryWrapper);
        return res;
    }
}
